package com.kws.merchant.controller;


import com.kws.merchant.domain.ItemMaterial;
import com.kws.merchant.domain.po.ItemMaterialPo;
import com.kws.merchant.service.ItemMaterialService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import com.kws.common.core.domain.R;

import javax.annotation.Resource;
import java.util.List;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * 报价-项目资料管理(ItemMaterial)表控制层
 *
 * @author yxy
 * @since 2024-10-24 14:46:59
 */
@RestController
@Api(tags = "报价-项目资料管理(ItemMaterial)")
@RequestMapping("itemMaterial")
public class ItemMaterialController {
    /**
     * 服务对象
     */
    @Resource
    private ItemMaterialService itemMaterialService;

    @PostMapping("/page")
    @ApiOperation(value = "分页查询列表")
    public R<Page<ItemMaterial>> pageList(@RequestBody ItemMaterialPo itemMaterialPo) {
        return R.ok(itemMaterialService.pageList(itemMaterialPo));
    }

    @GetMapping("/detailById/{id}")
    @ApiOperation(value = "通过主键查询单条数据")
    public R detailById(@PathVariable Long id) {
        return R.ok(itemMaterialService.detailById(id));
    }

    @PostMapping("/add")
    @ApiOperation(value = "新增数据")
    public R add(@RequestBody ItemMaterial itemMaterial) {
        return R.ok(itemMaterialService.save(itemMaterial));
    }

}
